package com.demo.jetpack

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController
import com.demo.jetpack.databinding.AFragmentBinding

class AFragment: Fragment() {

    private val mViewBinding by lazy {
        AFragmentBinding.inflate(layoutInflater)
    }

    private val mSharedViewModel by appViewModels<SharedViewModel>()

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        DataBindingUtil.bind<AFragmentBinding>(mViewBinding.root)?.apply {
            userAction = AUserAction(requireContext(), mSharedViewModel, findNavController())
        }
        return mViewBinding.root
    }

}